<template>
  <div class=" main" v-title data-title="外部科技成果库">
    <a-affix :offset-top="66">
      <div class="banner" :style="{background: 'url('+require('@/assets/policy/banner.png')+')',height:'80px',backgroundSize: 'cover'}">
        <div class="title-box">
          <p  class="title" >外部科技成果库</p>
        </div>
    </div>
    </a-affix>
    <FixedMenu menuClass="fixed-menu">
      <div class="fixed-menu">        
          <div  class="functionMould" style="background-color: #ffffff;" @click="handlehHstory">
            <a-icon type="history" class="menu-icon" />
            <span> 旧版历史<br/>文件</span>
          </div>           
          <div v-has="'technologyLib:add'" class="functionMould" style="background-color: #ffffff" @click="handleNewFile">
            <a-icon type="file-add" class="menu-icon" />
            <span> 新建文档</span>
          </div>
          <div class="functionMould" style="background-color: #ffffff" @click="handleMyFile">
            <a-icon type="file-text" class="menu-icon" />
            <span> 我的文档</span>
          </div>
          
          <div v-has="'technologyLib:privateGroup'" class="functionMould" style="background-color: #ffffff" @click="handleGroup">
            <a-icon type="lock" class="menu-icon" />
            <span>私有组</span>
          </div>
          <div v-has="'technologyLib:admin'" class="functionMould" style="background-color: #ffffff" @click="handleFileClass">
            <a-icon type="hdd" class="menu-icon" />
            <span>文件大类管理</span>
          </div>
            <div v-has="'technologyLib:add'" class="functionMould" style="background-color: #ffffff" @click="handleBatchFile">
            <a-icon type="hdd" class="menu-icon" />
            <span>批量上传</span>
          </div>
          <div v-has="'hatchProject:list'" class="functionMould" style="background-color: #ffffff" @click="gotoHatchProject">
            <a-icon type="file-ppt" class="menu-icon" />
            <span>发起孵化</span>
          </div>
           <div v-has="'projectBuild:add'" class="functionMould" style="background-color: #ffffff" @click="gotoProject">
            <a-icon type="file-add" class="menu-icon" />
            <span>发起立项</span>
          </div>
          <div v-has="'projectBuild:add'" class="functionMould" style="background-color: #ffffff" @click="togoGuidanceDoc">
            <a-icon type="read" class="menu-icon" />
            <span>模板</span>
          </div>
        </div>
    </FixedMenu>   
    <div class="fixedNav-left" v-has="'tcg:view'">
      <div class="tab-Report" @click="gotoOtherHref('/techResult/orderList')">
        <span class="iconfont icon-jiaoyi1"></span>
        <p>成果交易</p>
      </div>
    </div> 
     <div class="container">
       <div class="trademark-nav" :class="{'trademark-nav-hidden': showMore}">      
         <div class="projec-class-box clearFix  projec-class-input">
            <div>
              <div class="projec-class-lable" style="float:left">签收状态：</div>
              <ul class="projec-class-list clearFix" >
                <li :class="['hoverShow',{clickShow:!searchTab.signStatus||searchTab.signStatus==0}]" @click="ToggleSelectType(null,'signStatus')">全部</li>
                <li :class="['hoverShow',{clickShow:searchTab.signStatus==v.code}]" @click="ToggleSelectType(v.code,'signStatus')" v-for="(v,i) in dics.signStatus" :key="i">{{v.name}}</li>
              </ul>
            </div>
        </div>
        <div class="projec-class-box clearFix  projec-class-input" :class="{'project-class-more': more.moreRef0Class}" ref="moreRef0">
            <div>
              <div class="projec-class-lable" style="float:left">一级分类：</div>
              <ul class="projec-class-list clearFix" :class="{'projec-class-list-more': more.moreRef0}">
                <li :class="['hoverShow',{clickShow:classId==v.key}]" @click="onSelectClass([v.key])" v-for="(v,i) in treeData" :key="i">{{v.label}}</li>
              </ul>
              <div class="btn-more" @click="changeMore('moreRef0')">更多<a-icon :class="[ 'icon-child-down', { 'icon-child-up': more.moreRef0 }]" slot="suffixIcon" type="caret-up"/></div>
            </div>
        </div>
      </div>
      <div class="trademark-tap"> 
        <span @click="showMore = !showMore">全部{{ !showMore ? '收起' : '展开'}}
          <a-icon :class="[ 'icon-child-down', { 'icon-child-up': showMore }]" slot="suffixIcon" type="caret-up"/>
        </span>
      </div>
      <div class="data-main" :class="{'shrinkage': shrinkageFlag}">          
        <div class="box-left ant-table-scroll" >
          <div class="tree-title">
            <span class="bold">目录</span>
            <a-icon type="menu-fold" @click="shrinkageFlag = !shrinkageFlag"  :title="!shrinkageFlag? '收缩目录' : '展开目录'"/>
          </div>
          <div class="tree" v-if="!shrinkageFlag">
            <a-tree                             
              v-if="treeData.length"
              :tree-data="treeData"
              :selectedKeys="treeSelectedKeys"
              @select="onSelectClass"
              :row-selection="rowSelection"
              :show-line="true"
            />
          </div>
        </div>
        <div class="box-right" >                
          <div class="main-top">
            <div>
            <a-checkbox  :indeterminate="indeterminate" :checked="checkAll" @change="onCheckAllChange">
              全选
            </a-checkbox>       
            <a-button icon="reload" @click="handleReload">刷新</a-button>
            <a-button @click="handleCollect">收藏文档</a-button>
            <a-button icon="star" @click="handleUnCollect">取消收藏</a-button>             
            <a-button  v-show="btnFlag"  @click="handleAllFile"  
              >共享给我的</a-button
            >           
            <a-button v-show="btnFlag"  :type="ipagination.myFlag == 1  ? 'primary' : ''"
              @click="handleMyFile"                              
              >我起草的文档</a-button
            >
            <a-button v-show="btnFlag"  :type=" ipagination.myManager == 1 ? 'primary' : ''" 
              @click="handleMyManagerFile"                               
              >我管理的文档</a-button
            >
            <a-button icon="star" v-show="btnFlag" @click="handleMyCollect" :type="ipagination.myCollectFlag == 1 ? 'primary' : ''">我的收藏</a-button>
            <a-button icon="delete" v-show="ipagination.myFlag == 1 || ipagination.myManager == 1" @click="handleDelete">删除</a-button>
            <a-button :loading="exportLoading" icon="download" v-if="ipagination.myFlag == 1 || ipagination.myManager == 1" @click="handleExportExcel">导出</a-button>
          
            <a-input-group compact>
              <a-input-search :allowClear="true"  placeholder="按文件名称、文件编号、关键词模糊查询" @change="onSearch" v-model="ipagination.allSearch"  @search="onSearch" />
            </a-input-group>
            </div>
            <div class="right-side">                
              <div :class="{'active': typeFlag === 'list'}" @click="typeFlag = 'list'"><a-icon type="bars" />横向</div>                
              <div :class="{'active': typeFlag === 'card'}" @click="typeFlag = 'card';"><a-icon type="appstore" />卡片</div>                      
            </div>
          </div>
          <div :class="['main-table',`project-${typeFlag}`]">
            <a-spin :spinning="loading">
              <a-checkbox-group v-model="selectedRowKeys" @change="onListChange">
                <a-empty v-if="fileList.length == 0 && !loading"/>
                <div class="tab-info risk-list-hover" v-for="(item) of fileList" :key="item.id" >    
                  <template v-if="typeFlag=='list'">
                    <div>
                      <div class="allSelect"> 
                        <a-checkbox :value="item.id"></a-checkbox>
                      </div>
                      <div class="text-hidden list-title" :title="item.fileName" @click="handleViewFile(item)" >
                        <span> <i class="new-box" v-if="checkNew(item)">NEW</i>{{item.fileTypeName}}</span>
                        <span>{{item.fileNo}}</span>
                        <span>{{item.fileName}}</span>
                      </div>
                    </div>
                    <div>
                      <div class="line-bar-box">
                        <span v-for="(attr,j) of item.showInTableAttr" :key="j">{{attr.name}}：
                          <span v-if="attr.name == '申报状态' && attr.content == '已截止'" style="color:#b1b1b1">{{!!attr.content?attr.content:'--'}}</span> 
                          <span v-else-if="attr.name == '申报状态'" style="color:red">{{!!attr.content?attr.content:'--'}}</span>
                          <span v-else-if="attr.name == '相关企业'" style="color:red">{{!!attr.content?attr.content:'--'}}</span>
                          <span v-else-if="attr.name == '文件状态' && attr.content == '已失效'" style="color:#b1b1b1">{{!!attr.content?attr.content:'--'}}</span> 
                          <span v-else-if="attr.name == '文件状态'" style="color:red">{{!!attr.content?attr.content:'--'}}</span> 
                          <span v-else >{{!!attr.content?attr.content:'--'}}</span>
                        </span>
                      </div>
                      <div class="tip-span line-bar-box">
                        <span @click.stop="handleShowLog(1, item)"><a-icon type="eye" theme="filled" style="margin-right:3px;" />查看 {{(item.fileActionCount && item.fileActionCount.readN) || '0'}}</span>
                        <span @click.stop="handleShowLog(3, item)"><a-icon type="star" theme="filled" style="margin-right:3px;" />收藏 {{ (item.fileActionCount && item.fileActionCount.collectN) || '0' }}</span>
                        <span @click.stop="handleShowLog(2, item)"><a-icon type="download" style="margin-right:3px;" />下载 {{(item.fileActionCount && item.fileActionCount.downloadN) || '0'}}</span>
                        <span title="分享" v-if="item.fileAuthority && item.fileAuthority.split(',').indexOf('6')>-1">
                          <FileShareForm :fileId="item.id" type="text"/>
                        </span>
                      </div>
                    </div>
                  </template> 
                  <template v-else>
                    <div>
                      <div class="line-bar-title">
                        <div class="allSelect"> 
                          <a-checkbox :value="item.id"></a-checkbox>
                        </div>
                        <a :title="item.fileTypeName + item.fileNo + item.fileName" @click="handleViewFile(item)" >
                          <span><i class="new-box" v-if="checkNew(item)">NEW</i></span>
                          <span>{{item.fileName}}</span>
                        </a>
                      </div>
                      <template v-if="item.showInTableAttr && item.showInTableAttr.length">
                        <p class="line-bar-p" v-for="(attr,j) of item.showInTableAttr" :key="j">
                          <span>{{attr.name}}：</span>
                          <span v-if="attr.name == '申报状态' && attr.content == '已截止'" style="color:#b1b1b1">{{!!attr.content?attr.content:'--'}}</span> 
                          <span v-else-if="attr.name == '申报状态'" style="color:red">{{!!attr.content?attr.content:'--'}}</span>
                          <span v-else-if="attr.name == '相关企业'" style="color:red">{{!!attr.content?attr.content:'--'}}</span>
                          <span v-else-if="attr.name == '文件状态' && attr.content == '已失效'" style="color:#b1b1b1">{{!!attr.content?attr.content:'--'}}</span> 
                          <span v-else-if="attr.name == '文件状态'" style="color:red">{{!!attr.content?attr.content:'--'}}</span> 
                          <span v-else >{{!!attr.content?attr.content:'--'}}</span>
                        </p>
                      </template> 
                      <template v-else> 
                        <div class="line-bar-div">
                          <div :title="item.fileTypeName">{{item.fileTypeName}}</div>
                          <div :title="item.fileNo">{{item.fileNo}}</div>                 
                        </div>
                      </template>                     
                    </div>
                    <div class="tip-span line-bar-box">
                      <span @click.stop="handleShowLog(1, item)" title="查看"><a-icon type="eye" theme="filled"/> {{(item.fileActionCount && item.fileActionCount.readN) || '0'}}</span>
                      <span @click.stop="handleShowLog(3, item)" title="收藏"><a-icon type="star" theme="filled"/> {{ (item.fileActionCount && item.fileActionCount.collectN) || '0' }}</span>
                      <span @click.stop="handleShowLog(2, item)" title="下载"><a-icon type="download" /> {{(item.fileActionCount && item.fileActionCount.downloadN) || '0'}}</span>
                      <span title="分享" v-if="item.fileAuthority && item.fileAuthority.split(',').indexOf('6')>-1">
                        <FileShareForm :fileId="item.id" type="text"/>
                      </span>
                    </div>
                  </template>               
                </div>
              </a-checkbox-group>              
              <a-pagination            
                v-model="ipagination.current"
                size="small"
                show-size-changer
                :showTotal="ipagination.showTotal"
                :page-size.sync="ipagination.pageSize"
                :total="ipagination.total"
                :pageSizeOptions="ipagination.pageSizeOptions"
                @change="handleListChange"
                @showSizeChange="handleListChange"
              />
            </a-spin>            
          </div>
        </div>
      </div>        
     </div>
    <div class="app-box-outter">
    </div>
    <index-lib-log-modal ref="logModal" />
  </div>
</template>

<script>
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import { getAction, postAction ,getActionAsync,downFile,downloadFileLink } from '@/api/manage'
import IndexLibLogModal from './modules/IndexLibLogModal'
import moment from 'moment'
import {policylLevel}  from  '@/views/library/dics'
import { formatDate } from '@/utils/util'
import cloneDeep from 'lodash/cloneDeep'
import { ResizeHandleMoreMixin } from '@/mixins/ResizeHandleMoreMixin'
import FixedMenu from '@/components/tools/FixedMenu'
const rowSelection = {
  onChange: (selectedRowKeys, selectedRows) => {
    console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
  },
  onSelect: (record, selected, selectedRows) => {
    console.log(record, selected, selectedRows)
  },
  onSelectAll: (selected, selectedRows, changeRows) => {
    console.log(selected, selectedRows, changeRows)
  },
}

export default {
  name: 'TechnologyMg',
  components: {
    IndexLibLogModal,
    FixedMenu,
    FileShareForm: () => import('@/views/library/components/FileShareForm')
  },
  mixins: [ResizeHandleMoreMixin],
  props: {
    parentId:{
    default:null
  }},
  data() {
    return {
      typeFlag: 'list', // 默认横向
      forecast:[],
      showMore: false,      
      indeterminate:false,
      checkAll:false,
      plainOptions:[],
      cityData:[],
      searchTab:{       
        signStatus:2,
      },
      dics:{
       
        signStatus:[{code:'1',name:'已签收'},{code:'2',name:'未签收'}],
      },
      // parentId: this.$route.params && this.$route.params.id, //库id
      searchForm: {},
      columns: [
        {
          title: '文件编号',
          dataIndex: 'fileNo',
          key: 'fileNo',
          fixed: 'left'
        },
        {
          title: '文件名称',
          dataIndex: 'fileName',
          key: 'fileName',
          scopedSlots: { customRender: 'fileName' },
        },
        {
          title: '文件类别',
          dataIndex: 'fileTypeName',
          key: 'fileTypeName',
        },
        {
          title: '发布日期',
          dataIndex: 'effectTime',
          key: 'effectTime',
        },
        {
          title: '操作',
        },
      ],
      rowSelection,
      ipagination: {
        allSearch:'',
        current: 1,
        pageSize: 30,
        pageSizeOptions: ['30', '50', '100'],
        showTotal: (total, range) => {
          return range[0] + '-' + range[1] + ' 共' + total + '条'
        },
    
        fileType: 0,
        total: 0,
        signFlag:2
      },
      
      loading: false,
      treeData: [],
      treeDataShow:[],
      fileList: [],
      selectedRowKeys: [],
      loading: false,
      treeSelectedKeys: [],
      url: {
        list: '/lib/hteLibFile/list',
        getTreeList: '/lib/hteFileClass/getTreeList',
        collectOperate: '/lib/hteLibLog/collect',
        unCollectOperate: '/lib/hteLibLog/unCollect',
        listAttr: '/lib/hteFileClass/listAttr',
        statis: '/lib/hteLibLog/statis',
        deleteFile: '/lib/hteLibFile/deleteBatch',
        exportDynamicExcel: '/lib/hteLibFile/exportDynamicExcel',
        specialList: "/policy/policySpecial/list",
        mechanismList: "/policy/policyMechanism/list",
        businessList: "/policy/policyBusiness/list",
        areaInfo:'/manage/codeInfo/areaInfo',
        ifSign: '/lib/hteLibFile/ifSign/',
        hteLibPolicyForecast:'/policy/hteLibPolicyForecast/add',
        forecastList:'/policy/hteLibPolicyForecast/list'
      },
      classId: this.$route.params && this.$route.params.id,
      userinfo: {
        info: this.$store.getters.userInfo,
        module: 'home',
        badgecount: '',
      },
      exportLoading:false,
      btnFlag:false,
      projectPavilionType: this.$route.query.type,
      shrinkageFlag:false,
    }
  },
  computed:{
    checkNew(){
      return function(row){
          var createTime = row.createTime
          var myDate = new Date();
          myDate.setDate(myDate.getDate() - 10);
          myDate = new Date(formatDate(myDate.getTime(), 'yyyy-MM-dd'))
          const dateRow = new Date(createTime);
      
        if(!row.ifSign && dateRow.getTime() > myDate.getTime()){
          return true
        }else{
           return false
        }
            
      }  
    }
  },
  watch:{
    parentId:function(val,oldVal){
        this.initData();
    }
  },
  mounted () {
    this.initData();
  },
  methods: {
    initData(){        
      this.classId = this.parentId
      this.fetchClassAttr()
      this.fetchClassTree()      
    },
    /**
     * 头部查询方法
     */
    onSearch() {
      this.fetchFileList()
    },
    /**
     * 选择树节点，切换列表数据
     */
    onSelectClass(selectedKeys,e) {
      if(e&&!e.selected){
        selectedKeys = this.treeSelectedKeys
      }
      this.classId = selectedKeys[0]
      this.ipagination.fileType = selectedKeys[0]
       this.treeSelectedKeys = selectedKeys
      this.fetchClassAttr()
      this.fetchFileList(1)
    },
    onTreenChange(value){
      
      this.classId = value
      this.ipagination.fileType = value
      this.$forceUpdate();
      this.fetchClassAttr()
      this.fetchFileList()
      
    },
    /**
     * 表结构切换页码
     */
    handleTableChange(pagination, filters, sorter) {
      this.ipagination = pagination
      this.ipagination.pageNo = this.ipagination.current
      this.fetchFileList()
    },
    handleListChange(page,pageSize){
       this.ipagination.pageSize = pageSize
      this.ipagination.pageNo = page
      this.fetchFileList()
    },
    /**
     * 加载用户的分类树
     */
    async fetchClassTree() {
      const that = this
      getAction(this.url.getTreeList, { parentId: that.classId }).then((res) => {
        if (res.success) {
          res.result.treeList[0].selectable = true
          that.treeDataShow =[...res.result.treeList]
         that.treeData = res.result.treeList[0].children ? res.result.treeList[0].children.filter(item => {
            return item.label == '外部技术成果'
          }) : []
          that.classId = that.treeData[0].value;
          // 用于项目馆的查看更多文件点进来默认对应目录 modify by dr 20211220
          if (that.projectPavilionType) {
            that.classId = parseInt(that.projectPavilionType)
          } 
          that.treeSelectedKeys = [that.classId]
          
          that.ipagination.fileType =  that.classId
          let allTree = {children:null,label:'全部',title:'全部',key:res.result.treeList[0].value,value:res.result.treeList[0].value}
         
          that.treeData.unshift(allTree)

    

          that.fetchFileList(1)

        }
      })
    },
    getQueryParams(){
      this.ipagination.fileType = this.classId
      let param = Object.assign({},this.ipagination)
      delete param.showTotal
      delete param.pageSizeOptions
      this.ipagination.pageNo = this.ipagination.current
      param.classId = this.$route.params && this.$route.params.id
      return param;
    },
    clearQueryParams(arg){
      if(arg==1){
        //清空搜索框
        this.ipagination.allSearch = ''
      }
      this.ipagination.current = 1
      this.ipagination.searchTabJson = '';
      this.ipagination.signFlag = 0
      this.searchTab = {
      
        signStatus:0,
        
        
      }
      
    },
     onSearch() {
      this.clearQueryParams(0)
      this.fetchFileList(1)
    },
    handleReload(){
      this.clearQueryParams(1)
      this.fetchFileList(1)
    },
    async fetchFileList() {
      this.showBtn();
      this.loading = true
      this.fileList = []
      this.ipagination.fileType = this.classId
      let param = this.getQueryParams()
      this.ipagination.pageNo = this.ipagination.current
      const that = this
     param.actionFlag=true
      getAction(this.url.list, param).then( (res) => {
        if (res.success) {
           this.selectedRowKeys = []
           this.onListChange([])
          
          this.fileList = res.result.records || res.result
          this.plainOptions = [];
          if (res.result.total) {
            that.ipagination.total = res.result.total
          } else {
            that.ipagination.total = 0
          }

          this.fileList.forEach((row) => {
            that.plainOptions.push(row.id)
            let showInTableAttr = []
            if( row.attrs){
              
               row.attrs.forEach((attr) => {
                 if (attr.showInTable) {
                    row[attr.name] = attr.content
                   
                    showInTableAttr.push(attr) 
                 }
                })
                
            }
            row.showInTableAttr = showInTableAttr;
          })          
        }
        if (res.code === 510) {
          this.$message.warning(res.message)          
        }
        this.loading = false
      })
    },
    
    onSelectChange(selectedRowKeys) {
      this.selectedRowKeys = selectedRowKeys
    },
    handleCollect() {
     
      var ids = this.getSelect()
      if(!!ids){
          const that = this
      getAction(that.url.collectOperate, { fileIds: ids }).then((res) => {
        if (res.success) {
          that.$message.success(res.message)
          that.fetchFileList();
        } else {
          that.$message.warning(res.message)
        }
      })
      }
      
    },
    handleUnCollect(){
      
      var ids = this.getSelect()
      if(!!ids){
          const that = this
           this.$confirm({
        title: '确定取消收藏文档？',
        onOk() {
            getAction(that.url.unCollectOperate, { fileIds: ids }).then((res) => {
        if (res.success) {
          that.$message.success(res.message)
          that.fetchFileList();
        } else {
          that.$message.warning(res.message)
        }
       })
        }
        })
      
      }
    },
  
 
    getSelect(){
       var ids = ''
       if (this.selectedRowKeys.length <= 0) {
        this.$message.warning('请选择一条记录！')
      }
     
      for (var a = 0; a < this.selectedRowKeys.length; a++) {
        ids += this.selectedRowKeys[a] + ','
      }
      return ids
    },
    handleDelete(){
      let ids = this.getSelect()
       if(!!ids){
        const that = this
        this.$confirm({
        title: '确定要删除选中的文件？',
        onOk() {
            getAction(that.url.deleteFile, { ids: ids }).then((res) => {
            if (res.success) {
              that.$message.success(res.message)
              that.fetchFileList(1);
              
            } else {
              that.$message.warning(res.message)
            }
          })
        },
        onCancel() {},
      });
      
      }
    },
    handleExportExcel(){
      let param = this.getQueryParams();
  
      console.log("导出参数",param)
      this.exportLoading = true;
      downloadFileLink(this.url.exportDynamicExcel,'科技图书馆导出.xls', param,{type: 'application/vnd.ms-excel'}).then((data)=>{
        this.exportLoading = false;
      })
  
    },
    handleViewFile(row) {
      // this.$router.push('/library/file/info/' + row.id)
      // this.$router.push()
      // window.open('/library/file/info/' + row.id)
      if (this.ipagination.myFlag == 1 || this.ipagination.myManager == 1) {
        let urlJump = this.$router.resolve({ path: '/library/file/edit/' + this.parentId + '/' + row.id + '/' + row.draftVersion })
        window.open(urlJump.href, '_blank')
      } else {
        let urlJump = this.$router.resolve({ path: '/library/file/view/' + this.parentId + '/' + row.id + '/' + row.version })
        window.open(urlJump.href, '_blank')
      }
    },
    handleNewFile() {
      let urlJump = this.$router.resolve({ path: '/library/file/new/' + this.parentId })
      window.open(urlJump.href, '_blank')
    },
    handleFileClass() {
      let urlJump = this.$router.resolve({ path: '/library/fileClass/' + this.parentId })
      window.open(urlJump.href, '_blank')
    },
    handleBatchFile() {
      let urlJump = this.$router.resolve({ path: '/library/file/batch/' + this.parentId })
      window.open(urlJump.href, '_blank')
    },
    handleGroup() {
      let urlJump = this.$router.resolve({ path:'/library/group'})
      window.open(urlJump.href, '_blank')
    },
    gotoProject() {
      let urlJump = this.$router.resolve({ path:'/projectbuildstup/baseInfo?projectClass=62&projectType=MG'})
      window.open(urlJump.href, '_blank')
    },
    gotoHatchProject() {
      let urlJump = this.$router.resolve({ path:'/hatchProjectBuildstep/baseInfo?projectClass=62&projectType=MG'})
      window.open(urlJump.href, '_blank')
    },
    togoGuidanceDoc(){
      let urlJump = this.$router.resolve({ path:'/projectGuidanceDoc?mgFlag=1'})
      window.open(urlJump.href, '_blank')
    },
    handlehHstory(){
       window.open(this.HTE_OLD_SERVER_URL + '/book/index' + `?bootToken=${Vue.ls.get(ACCESS_TOKEN)}`, '_blank')
    },
    projectBuild(){
       if (this.selectedRowKeys.length != 1) {
        this.$message.warning('请选择一条记录！')
        return;
      }
      let fileId = this.selectedRowKeys[0]; 
      let file = this.fileList.find(item=>{
       return item.id ==   fileId    })
       if(!!file){
         
         var filePolicy = file.fileNo + file.fileName + file.version
         let urlJump = this.$router.resolve({ path:`/projectbuildstup/baseInfo?projectClass=60`+'&projectType='+'MB'+'&filePolicy='+filePolicy })
         window.open(urlJump.href, '_blank')
       }
      
    },
    handleAllFile() {
      
      this.ipagination.myFlag = 0
      this.ipagination.myManager = 0
      this.ipagination.myCollectFlag = 0
      this.ipagination.signFlag = 0
      this.ipagination.fileType = this.parentId
      
      this.fetchFileList(1)
    },
    handleMyManagerFile() {
      this.ipagination.myFlag = 0
      this.ipagination.myManager = 1
      this.ipagination.myCollectFlag = 0
      // this.ipagination.signFlag = 0
      this.ipagination.fileType = this.parentId
      this.fetchFileList(1)
    },
    handleMyFile() {
      this.ipagination.myFlag = 1
      this.ipagination.myManager = 0
      this.ipagination.myCollectFlag = 0
      // this.ipagination.signFlag = 0
      this.ipagination.fileType = this.parentId
      
      this.fetchFileList(1)
    },
    handleMyCollect() {
      this.ipagination.myFlag = 0
      this.ipagination.myManager = 0
      this.ipagination.myCollectFlag = 1
      // this.ipagination.signFlag = 0
      this.ipagination.fileType = this.parentId
      this.fetchFileList(1)
    },
    handleSignFlag(flag) {
      this.ipagination.myFlag = 0
      this.ipagination.myManager = 0
      this.ipagination.myCollectFlag = 0
      this.ipagination.signFlag = flag
      this.ipagination.fileType = this.parentId
      this.fetchFileList(1)
    },
    /**
     * 获取分类扩展属性
     */
    fetchClassAttr() {
      getAction(this.url.listAttr, { classId: this.classId }).then((res) => {
        if (res.success) {
          let attrs = res.result
          this.columns = [
            {
              title: '文件编号',
              dataIndex: 'fileNoStr',
              key: 'fileNoStr',
              scopedSlots: { customRender: 'fileNoStr' },
              // fixed: 'left',
            },
            {
              title: '文件名称',
              dataIndex: 'fileName',
              key: 'fileName',
              scopedSlots: { customRender: 'fileName' },
              //  fixed: 'left',
            },
            {
              title: '文件类型',
              dataIndex: 'fileTypeName',
              key: 'fileTypeName',
            },
              {
              title: '发布日期',
              dataIndex: 'effectTime',
              key: 'effectTime',
            },
            
          ]
          if (attrs != null) {
            attrs.forEach((attr) => {
              if (attr.showInTable) {
                this.columns.push({
                  title: attr.name,
                  dataIndex: 'attr' + attr.id,
                  key: 'attr' + attr.id,
                })
              }
            })
          }
          this.columns.push({
            title: '实施日期',
            dataIndex: 'issuedDate',
            key: 'issuedDate',
          })      
        }
      })
    },
    handleShowLog(type,record){
      this.$refs.logModal.showLog(type,record.id)
    },
    ToggleSelectType(code,type){

      this.searchTab[type]=code
      if(type === 'signStatus'){
       this.ipagination.signFlag = code
       
      }
      
     
      this.searchTab =  Object.assign({},this.searchTab)
      
      this.ipagination.searchTabJson =  JSON.stringify(this.searchTab)
      this.fetchFileList(1);
    },
  
    disabledDate(current) {
      return current && current <= moment().endOf('day');
    },
    onChangeMonth(value){
      this.searchTab.publish=value;
      this.$forceUpdate();
       this.ToggleSelectType(value,'publish')
    },
    checkIsNew(row) {
      let isNew = false
      var createTime = row.createTime
      var myDate = new Date();
      myDate.setDate(myDate.getDate() - 10);
      myDate = new Date(formatDate(myDate.getTime(), 'yyyy-MM-dd'))
      const dateRow = new Date(createTime);
       getAction(this.url.ifSign + row.id).then(res=>{
          if (res.success) {
          if(!res.result && dateRow.getTime() > myDate.getTime()){
            this.$set(row, 'ifSign',true)
            row.ifSign = true
          }
        } else {
          this.$message.error(res.message)
        }
       })
    },
    onListChange(checkedList){
      
       this.indeterminate = !!checkedList.length && checkedList.length < this.plainOptions.length;
      this.checkAll = checkedList.length === this.plainOptions.length && this.plainOptions.length > 0;
    },
    onCheckAllChange(e){
      Object.assign(this, {
        selectedRowKeys: e.target.checked ? this.plainOptions : [],
        indeterminate: false,
        checkAll: e.target.checked,
      });
    },
    showBtn(){
      if(this.ipagination.myFlag == 1 || this.ipagination.myManager == 1 || this.ipagination.myCollectFlag == 1){
        this.btnFlag = true;
      }else{
        this.btnFlag = false;
      }
    },
    gotoOtherHref(url){
      let urlJump = this.$router.resolve({ path: url })
      window.open(urlJump.href, '_blank')
    },  
  },
}
</script>

<style lang="less" scoped>
@import '~@views/library/hteFile.less';
  /deep/ .j-table-force-nowrap{
    th{
    white-space: normal !important;
    }
  } 

.list-header{
  height: 28px;
   white-space: nowrap;
  overflow: hidden;
  position: relative;
  padding-left: 10px;

  span,a{
    // max-width: 15%;
    display: inline-block;
    font-weight: bold;
    font-size: 15px;
    padding-right: 16px;
    overflow: hidden;
    text-overflow:ellipsis;
    white-space: nowrap;
  }
  a{
     max-width: 70%;
  }
     .status {
    width: 68px;
    padding: 0 7px;
    text-align: center;
    position: absolute;
    right: 0;
  z-index: 999;
  position: absolute;
  
}
}
 /deep/ .list-content{
   .ant-col{
      overflow: hidden;
      text-overflow:ellipsis;
      white-space: nowrap;
      position: relative;
      text-align: left;
      padding-left: 10px;
   }
   .ant-col::after{
     position: absolute;
     top: 10%;
     right: 0;
     content: '';
     display: inline-block;
     height: 80%;
     width: 1px;
     background: #e8e8e8;

   }
    .ant-col.noline::after{
     display:none;
   }
}

.app-log {
  font-size: 24px;
  font-weight: bold;
}
.app-box-outter {
  width: 100%;
  display: flex;
  justify-content: center;
}
.app-box-inner {
  width: 70vw;
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  position: relative;
}
.menu-list {
  width: 70vw;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  background-color: red;
}
.menu-item {
  padding: 22px 10px;
  font-size: 16px;
  font-weight: 200;
  color: #ffffff;
  cursor: pointer;
}
.condition-box {
  width: 70vw;
}
.condition-all {
  padding: 3px 10px;
}
.condition-list {
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  background-color: #ffffff;
}
.condition-item {
  display: flex;
  justify-content: flex-start;
  height: 40px;
  line-height: 40px;
  border-bottom: #f5f5f5 solid 1px;
}
.condition-label {
  width: 100px;
  padding-left: 10px;
}
.condition-value {
  display: flex;
  justify-content: flex-start;
}
.condition-value div {
  padding: 0px 10px;
}
.data-main {
  display: flex;
  justify-content: flex-start;  

 padding-bottom: 15px;
}
.box-left {
  // width: 210px;
  background-color: #ffff;
  color: #000000;
  font-size: 16px;
  // min-width: 210px;
  // max-width: 210px;
  // height: 100%;
  // overflow:auto;
}
.ant-tree-switcher-line-icon {
  color: #ffffff !important;
}
.ant-tree li .ant-tree-node-content-wrapper {
  display: inline-block;
  height: 24px;
  margin: 0;
  padding: 0 5px;
  color: #ffffff;
  font-size: 14px;
  line-height: 24px;
  text-decoration: none;
  vertical-align: top;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.3s;
}
.box-right {
  background-color: #ffffff;
  font-size: 16px;
  position: relative;
  padding-bottom: 15px;
}
.main-top{  
  display: flex;
  flex-wrap: wrap;
  >div{
    flex: 1;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
  }
  /deep/ .ant-input-group.ant-input-group-compact{
    width: 16vw;
    display: inline-block;
  }
}
.main-top>div > * {
  margin: 5px;
}
.allSelect{
  position: absolute;
  top: 15px;
  left: 0;
  /deep/ .ant-checkbox + span{
    padding: 0;
  }
}
.fixed-menu {
  position: fixed;
  right: 20px;
  z-index: 1;
  width: 80px;
  top: 172px;
}
.functionMould {
  background-color: #ffffff;  
  padding: 10px;
  text-align: center;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  padding: 10px;
  cursor: pointer;
  &:hover{
    >span,>i{color: #146595}
  }
}
.functionMould > span {
  width: 100%;
  text-align: center;
  font-size: 12px;
  color: #000000;
  display: block;
}
.menu-icon {
  font-size: 24px;
  color: #31a0e1;
}
.ant-tree-switcher {
  background: unset !important;
}


/deep/ .avatar-uploader .el-upload-list__item-status-label {
    display:none;
  }
/deep/ .ant-form input[type='file'] {
    display: none;
}
/deep/ .ant-btn-primary{
  background: #4095e4;
  margin-right: 10px;
}
/deep/ .ant-btn-primary[disabled]{
 background-color: #f5f5f5;

}
/deep/ .ant-btn{
  // width: 85px;
  height: 30px;
  border-radius: 2px;
  margin: 2px;
  padding: 0 7px;
  span{margin-left: 2px;}
}

/deep/.trademarkInfoPopUp{
  .headerControl{
    text-align: right;
    margin-bottom: 10px;
  }
  .ant-modal-title{
    font-weight: 900;
  }
  .ant-modal-footer{
    text-align: center;
    padding: 20px;
  }
  .ant-modal-header{
    text-align: center;
  }
  .ant-descriptions-bordered .ant-descriptions-item-label{
    width: 170px;
    background-color: #d9dee8;
    border-bottom: 1px solid #f7f7f7
  }
  .ant-descriptions-view{
    border-radius: unset;
  }
  .ant-table-thead > tr > th {
    background: #dadee9 !important;
    padding: 10px;
  }
  .ant-table-thead > tr:first-child > th:first-child,.ant-table table{
    border-radius: unset;
    line-height: 1;
  }

  .ant-table-thead > tr:first-child > th:first-child,.ant-table table{
    border-radius: unset;
    line-height: 1;
  }
  .ant-table-tbody .ant-table-row td{
    padding-top: 10px;
    padding-bottom: 10px;
  }
}
/deep/ .productServicePopUp,/deep/ .intellectualInfoPopUp,/deep/.createTrademarkoPopUp{
  .ant-modal-title{
    font-weight: 900;
  }
  .ant-modal-header{
    text-align: center;
  }
  .ant-btn{
    width: fit-content;
  }
  .new-box{
    padding: 0 50px 20px;
  }
  .product-list{
    border: 1px solid #f5f5f5;
    border-radius: 3px;
    padding: 20px 50px;
    .product-name{
      margin-left: 20px;
    }
  }
  .ant-modal-footer{
    text-align: center;
    padding: 20px;
  }
  .btn{
    text-align: center;
    margin: 30px 0 0;
  }
  .ant-form-item{
    margin-bottom: 0;
  }
  .changeStyle .ant-form-item-label{
    line-height: unset;
    white-space:pre-wrap;
  }
  .upload-demo{
    /deep/ .ant-table-thead > tr > th {
      background: #d9dee8 !important;
    }
    /deep/.ant-table-thead > tr:first-child > th:first-child,/deep/ .ant-table table{
      border-radius: unset;
      line-height: 1;
    }
  }
}
/deep/ .selectKeywordPopUp {
  .ant-modal-title{
    font-weight: 900;
  }
  .ant-modal-header{
    text-align: center;
  }
  .ant-modal-footer{
    text-align: center;
    padding: 20px;
  }
}
/deep/ .processInforPopUp{
  .ant-modal-body{
    padding: 20px 75px;
  }
  .ant-timeline-item-head{
    background-color: #4095e4;
  }
  .ant-timeline-item-tail{
    border-left: 2px dotted #e8e8e8;
  }
  .processStep{
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #eee;
    padding: 0 10px;
    margin-top: 10px;
    .processTime{
      display: flex;
      font-weight: 700;
      span{
        display: inline-block;
        margin-right: 25px;
      }
    }
  }
}
/deep/ .mainTainPopUp,/deep/ .selectAgencyPopUp,/deep/.selectProposerPopUp,/deep/ .selectServicePopUp,/deep/ .productDetailPopUp{
  .ant-modal-title{
    color: #fff;
    font-weight: 900;
  }
  .ant-modal-body{
    padding: 24px 24px 0 24px;
  }
  .ant-input-group.ant-input-group-compact{
    display: flex;
    width: 40%
  }
  .ant-modal-header{
    background: #388cdb;
    color: #fff;
    text-align: center;
  }
  .ant-modal-footer{
    text-align: center;
    padding: 20px;
  }
  .ant-btn-primary{
    background: #4095e4;
  }
  .ant-btn{
    width: 85px;
    height: 30px;
    border-radius: 2px;
    margin-right: 10px;
  }
  .ant-table-thead > tr > th {
    background: #dadee9 !important;
    padding: 10px;
  }
  .ant-table-thead > tr:first-child > th:first-child,.ant-table table{
    border-radius: unset;
    line-height: 1;
  }

  .ant-table-thead > tr:first-child > th:first-child,.ant-table table{
    border-radius: unset;
    line-height: 1;
  }
  .ant-table-tbody .ant-table-row td{
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .headerControl{
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
  }
  .selected-box{
    border: 1px solid #eeeeee;
    border-radius: 5px;
    padding: 0px 0 0 10px;
    .ant-select-selection{
      border:unset;
      border-left: 1px solid #eee;
      border-radius: unset;
      margin-left: 10px;
    }
  }
}
  .toggleClick{
    background-color: #0581ca;
    border-bottom: 1px solid #1890ff;
    cursor: pointer;
  }
  .icon-plus{
    font-size: 13px;
    padding-right: 5px;
  }
  .main{
    min-height: 100%;
    background: #f5f5f5;
       
    position: relative;
  }
  .container{
    padding: 0 125px 100px;
    height: 100%;   
    .trademark-nav{
      background: #fff;      
      border-radius: 2px;
	    border: solid 1px #e2e2e2;
      color: #000;
      -webkit-transition: max-height,margin-top .3s;
      transition: max-height,margin-top .3s;
      overflow: hidden;
      max-height: 700px;
      margin-top: 15px;      
      .hoverShow{
        cursor: pointer;
        border-bottom: 3px solid rgba(255, 255, 255, 0);
        &:hover{
          border-bottom: 3px solid #31a0e1;
        }
      }
      .clickShow{
        border-bottom: 3px solid #31a0e1;
        color: #31a0e1;
        cursor: pointer;
      }      
      .projec-class-box{
          font-weight: 600;
          // background: #f5f5f5;
          display: flex;
          border-bottom:1px solid #f2f2f2;
          justify-content: center;
          align-items: center;
          &:last-of-type{border-bottom: none}
          .projec-class-lable{
            width: 120px;
            padding: 10px 0 10px 30px;
            // float: left;
            font-size: 15px;
            text-align: left;
          }
          .projec-class-list{
            width: calc(100% - 120px);
            padding-left: 10px;
            color: rgba(0, 0, 0, 0.65);
            margin: 0;
            display: block;
            position: relative;
            padding: 0;
            list-style: none;
            li{
              float: left;
              padding: 10px 15px;
            }
          } 
          &.projec-class-input{
            >div{flex: 1;}
            .projec-class-list{width: auto;}
          }
          .btn-more{display: none;}
          &.project-class-more{
            padding-right: 63px;
            position: relative;
            .btn-more{
              display: inline-block;
              position: absolute;
              right: 10px;
              top: 11px;
              padding: 0px 5px;
              cursor: pointer;
              color: #999;
              font-weight: normal;
              &:hover{
                color: #0581ca;
                background-color: #e4e4e4;
                .icon-child-down{
                  color: #0581ca;
                }
              }
            }
            ul{
              -webkit-transition: all .3s;
              transition: all .3s;
              overflow: hidden;
              max-height: 700px;
              &.projec-class-list-more{
                max-height: 44px;
              }
            }
          }     
      }
      &.trademark-nav-hidden{
        margin-top: 0;
        max-height: 0;
        border: 0;      
      }      
    }
    .trademark-tap{
      padding: 8px;
      width:100%;      
      text-align: center;
      color: #999;       
      >span{padding: 5px;cursor: pointer;
        &:hover{
          color: #0581ca;
          background-color: #e4e4e4;
          .icon-child-down{
            color: #0581ca;
          }
        }
      }      
    }
    .showTotal{
      vertical-align: middle;
    }
       .reservation-content{
         /deep/ .ant-table-body::-webkit-scrollbar-track {
                  background: #fff;
         }
          margin-top: 20px;
          /deep/ .ant-table-small{
            border: unset;
            border-radius: unset;
          }
          /deep/ .ant-table-thead > tr > th{
            border: unset;
            border-radius: unset;
          }
          /deep/ .ant-table-thead{
            background-color:#d5dae4 ;
          }
          /deep/ .ant-table-small > .ant-table-content > .ant-table-body{
            margin: 0;
          }
        }
    .trademark-content{
      background: #fff;
      margin-top: 10px;
      border: 1px solid #ededed;
      .controlarea{
        padding: 15px 0 5px 10px;
      }
      .trademark-list{
        .reservation-content{
          margin-top: 20px;
          /deep/ .ant-table-small{
            border: unset;
            border-radius: unset;
          }
          /deep/ .ant-table-thead > tr > th{
            border: unset;
            border-radius: unset;
          }
          /deep/ .ant-table-thead{
            background-color:#f6f7f9 ;
          }
          /deep/ .ant-table-small > .ant-table-content > .ant-table-body{
            margin: 0;
          }
        }
      }
    }
  }
.fixedNav-left {
  position: fixed;
  left: 30px;
  top: 172px;
  z-index: 1;
  >div {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 7px;
    cursor: pointer;
    border: 1px solid #31A0E1;
    color: #31A0E1;
    margin-bottom: 6px;
    border-radius: 4px;
    background: #fff;
    p {
      margin-bottom: 0;
      width: 56px;line-height: 14px;
    }
    .iconfont {
      color: #31A0E1;font-size: 19px;transition: all 0.3s;
    }
    &:hover {
      background-color: #e6f7ff;
      .iconfont {
        transform: scale(1.2);
      }
    }
  }
}  
/deep/ .ant-checkbox-group{width: calc(100% - 20px); margin: 0 10px;}
/deep/ .ant-empty{margin: 20px;}
@media (max-width: 1400px){
  .trademark-nav{
    /deep/ input,  /deep/ .ant-select{
      width: 152px !important;
    }
  }  
}  
@media all and (max-width: 1225px) {
  .projec-class-input{display: block !important;
    >div:not(:last-child){border-bottom: 1px solid rgb(242, 242, 242);}
  }
}  
@media (max-width: 1080px){
  .container{padding: 0 30px 100px !important}
}
.data-main .box-right .project-list .risk-list-hover{padding-right: 0}
.icon-child-down{
    font-size: 11px;
    margin-left: 3px;
    transition: all .3s;
    color: #999;
    &.icon-child-up{
      transform: rotate(180deg);
    }
  }      
  /deep/ .ant-list *{
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
  }
</style>